import { request } from "@/utils/service"
import type {
  PayOrderItemsData, PayOrderItemsReqData,
  PayOrderItemsReqListData,
  PayOrderItemsReqPageData, PayOrderItemsRespListData,
  PayOrderItemsRespPageData
} from "@/api/orderItems/types";



// 创建订单项
export function createPayOrderItems(data: PayOrderItemsData) {
  return request({
    url: '/private/pay/pay-order-items/create',
    method: 'POST',
    data: data
  })
}

// 更新订单项
export function updatePayOrderItems(data: PayOrderItemsData) {
  return request({
    url: '/private/pay/pay-order-items/update',
    method: 'PUT',
    data: data
  })
}

// 删除订单项
export function deletePayOrderItems(id?: string) {
  return request({
    url: '/private/pay/pay-order-items/delete?id=' + id,
    method: 'DELETE'
  })
}

// 获得订单项
export function getPayOrderItems(id: string) {
  return request({
    url: '/private/pay/pay-order-items/get?id=' + id,
    method: 'GET'
  })
}

// 获得订单项分页
export function getPayOrderItemsPage(query: PayOrderItemsReqPageData) {
  return request<PayOrderItemsRespPageData>({
    url: '/private/pay/pay-order-items/page',
    method: 'GET',
    data: query
  })
}

// 获得订单项列表
export function getPayOrderItemsList(query: PayOrderItemsReqListData) {
  return request<PayOrderItemsRespListData>({
    url: '/private/pay/pay-order-items/list',
    method: 'GET',
    data: query
  })
}


// 导出订单项 Excel
export function exportPayOrderItemsExcel(query: PayOrderItemsReqData) {
  return request({
    url: '/private/pay/pay-order-items/export-excel',
    method: 'GET',
    data: query,
    responseType: 'blob'
  })
}
